/*
 * Decompiled with CFR 0.150.
 * 
 * Could not load the following classes:
 *  cn.hutool.core.util.ObjectUtil
 *  de.felixroske.jfxsupport.FXMLController
 *  javafx.fxml.FXML
 *  javafx.fxml.Initializable
 *  javafx.scene.control.Alert
 *  javafx.scene.control.Alert$AlertType
 *  javafx.scene.layout.AnchorPane
 *  org.springframework.beans.factory.annotation.Autowired
 */
package com.gys.controller.salesReceipts;

import cn.hutool.core.util.ObjectUtil;
import com.gys.common.business.SalesReceiptsUtil;
import com.gys.common.data.HttpJson;
import com.gys.common.util.CacheUtil;
import com.gys.common.util.ConstUtil;
import com.gys.controller.BaseController;
import com.gys.controller.index.IndexController;
import com.gys.controller.replenish.ReplenishController;
import com.gys.controller.salesReceipts.SalesReceiptsMainController;
import com.gys.controller.salesReceipts.SingleChangeRateController;
import com.gys.data.example.GetLoginStoreOutData;
import de.felixroske.jfxsupport.FXMLController;
import java.net.URL;
import java.util.HashMap;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.layout.AnchorPane;
import org.springframework.beans.factory.annotation.Autowired;

@FXMLController
public class ApproveChangeRateController
extends BaseController
implements Initializable {
    private final int pageSize = ConstUtil.DEFAULT_PAGESIZE;
    private final int defaultPageCount = ConstUtil.DEFAULT_PAGECOUNT;
    @FXML
    private AnchorPane pane;
    @Autowired
    private ReplenishController acceptController;
    @Autowired
    private IndexController indexController;
    @Autowired
    private SalesReceiptsMainController salesReceiptsMainController;
    @Autowired
    private SingleChangeRateController singleChangeRateController;

    public void initialize(URL location, ResourceBundle resources) {
        this.init();
    }

    @Override
    public void init() {
        if (ObjectUtil.isEmpty(this.pane)) {
            return;
        }
    }

    @FXML
    private void approvePrice() {
        HashMap<String, Object> param = new HashMap<String, Object>();
        param.put("changeRate", this.singleChangeRateController.getChangeRate());
        param.put("index", this.salesReceiptsMainController.getIndexString());
        param.put("proCode", this.salesReceiptsMainController.getProCodeString());
        param.put("billNo", this.salesReceiptsMainController.getCaseId().getText());
        param.put("storeCode", ((GetLoginStoreOutData)CacheUtil.get("store")).getStoCode());
        HttpJson rsp = SalesReceiptsUtil.approveChangeRate(param);
        if (!rsp.isSuccess()) {
            Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", rsp.getMsg());
            alert.showAndWait();
            return;
        }
        this.salesReceiptsMainController.singleChangeRateDo(this.singleChangeRateController.getChangeRate());
        this.singleChangeRateController.closeWindows();
        this.pane.getScene().getWindow().hide();
    }

    @FXML
    private void closeWindows() {
        this.pane.getScene().getWindow().hide();
    }

    public int getPageSize() {
        return this.pageSize;
    }

    public int getDefaultPageCount() {
        return this.defaultPageCount;
    }

    public AnchorPane getPane() {
        return this.pane;
    }

    public ReplenishController getAcceptController() {
        return this.acceptController;
    }

    public IndexController getIndexController() {
        return this.indexController;
    }

    public SalesReceiptsMainController getSalesReceiptsMainController() {
        return this.salesReceiptsMainController;
    }

    public SingleChangeRateController getSingleChangeRateController() {
        return this.singleChangeRateController;
    }

    public void setPane(AnchorPane pane) {
        this.pane = pane;
    }

    public void setAcceptController(ReplenishController acceptController) {
        this.acceptController = acceptController;
    }

    public void setIndexController(IndexController indexController) {
        this.indexController = indexController;
    }

    public void setSalesReceiptsMainController(SalesReceiptsMainController salesReceiptsMainController) {
        this.salesReceiptsMainController = salesReceiptsMainController;
    }

    public void setSingleChangeRateController(SingleChangeRateController singleChangeRateController) {
        this.singleChangeRateController = singleChangeRateController;
    }

    public boolean equals(Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof ApproveChangeRateController)) {
            return false;
        }
        ApproveChangeRateController other = (ApproveChangeRateController)o;
        if (!other.canEqual(this)) {
            return false;
        }
        if (this.getPageSize() != other.getPageSize()) {
            return false;
        }
        if (this.getDefaultPageCount() != other.getDefaultPageCount()) {
            return false;
        }
        AnchorPane this$pane = this.getPane();
        AnchorPane other$pane = other.getPane();
        if (this$pane == null ? other$pane != null : !this$pane.equals(other$pane)) {
            return false;
        }
        ReplenishController this$acceptController = this.getAcceptController();
        ReplenishController other$acceptController = other.getAcceptController();
        if (this$acceptController == null ? other$acceptController != null : !(this$acceptController).equals(other$acceptController)) {
            return false;
        }
        IndexController this$indexController = this.getIndexController();
        IndexController other$indexController = other.getIndexController();
        if (this$indexController == null ? other$indexController != null : !(this$indexController).equals(other$indexController)) {
            return false;
        }
        SalesReceiptsMainController this$salesReceiptsMainController = this.getSalesReceiptsMainController();
        SalesReceiptsMainController other$salesReceiptsMainController = other.getSalesReceiptsMainController();
        if (this$salesReceiptsMainController == null ? other$salesReceiptsMainController != null : !(this$salesReceiptsMainController).equals(other$salesReceiptsMainController)) {
            return false;
        }
        SingleChangeRateController this$singleChangeRateController = this.getSingleChangeRateController();
        SingleChangeRateController other$singleChangeRateController = other.getSingleChangeRateController();
        return !(this$singleChangeRateController == null ? other$singleChangeRateController != null : !(this$singleChangeRateController).equals(other$singleChangeRateController));
    }

    protected boolean canEqual(Object other) {
        return other instanceof ApproveChangeRateController;
    }

    public int hashCode() {
        int PRIME = 59;
        int result = 1;
        result = result * 59 + this.getPageSize();
        result = result * 59 + this.getDefaultPageCount();
        AnchorPane $pane = this.getPane();
        result = result * 59 + ($pane == null ? 43 : $pane.hashCode());
        ReplenishController $acceptController = this.getAcceptController();
        result = result * 59 + ($acceptController == null ? 43 : ($acceptController).hashCode());
        IndexController $indexController = this.getIndexController();
        result = result * 59 + ($indexController == null ? 43 : ($indexController).hashCode());
        SalesReceiptsMainController $salesReceiptsMainController = this.getSalesReceiptsMainController();
        result = result * 59 + ($salesReceiptsMainController == null ? 43 : ($salesReceiptsMainController).hashCode());
        SingleChangeRateController $singleChangeRateController = this.getSingleChangeRateController();
        result = result * 59 + ($singleChangeRateController == null ? 43 : ($singleChangeRateController).hashCode());
        return result;
    }

    public String toString() {
        return "ApproveChangeRateController(pageSize=" + this.getPageSize() + ", defaultPageCount=" + this.getDefaultPageCount() + ", pane=" + this.getPane() + ", acceptController=" + this.getAcceptController() + ", indexController=" + this.getIndexController() + ", salesReceiptsMainController=" + this.getSalesReceiptsMainController() + ", singleChangeRateController=" + this.getSingleChangeRateController() + ")";
    }
}

